package RuMen_Demo;

import java.util.*;

public class 随机验证码 {
    public static void main(String[] args) {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        while (true) {
            String node = "";
            System.out.println("输入想生成的随机验证码位数：");
            int n = sc.nextInt();
            for (int i = 0; i < n; i++) {
                int m = r.nextInt(3);
                switch (m) {
                    case 0:
                        node += r.nextInt(10);
                        break;
                    case 1:
                        node += (char) (r.nextInt(26) + 97);
                        break;
                    case 2:
                        node += (char) (r.nextInt(26) + 65);
                        break;
                }
            }
            System.out.println("验证码：" + node + "\n");
        }
    }
}